package Client;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class ClientInitClose {

    private ObjectOutputStream out;
    private ObjectInputStream in;
    private Socket s;

    public ObjectOutputStream getOut() {
        return out;
    }

    public ObjectInputStream getIn() {
        return in;
    }


    public void clientInit() throws IOException {

        s = new Socket(InetAddress.getLocalHost(),8888);
        out = new ObjectOutputStream(s.getOutputStream());
        in = new ObjectInputStream(s.getInputStream());
        System.out.println("连接服务器成功！");
    }

    public void clientClose() throws IOException {
        in.close();
        out.close();
        s.close();
        System.out.println("客户端关闭成功！");
    }
}
